<?php


abstract class BaseRingtoneStatisticNewPeer {

	
	const DATABASE_NAME = 'propel';

	
	const TABLE_NAME = 'ringtone_statistic_new';

	
	const CLASS_DEFAULT = 'lib.model.RingtoneStatisticNew';

	
	const NUM_COLUMNS = 44;

	
	const NUM_LAZY_LOAD_COLUMNS = 0;


	
	const ID = 'ringtone_statistic_new.ID';

	
	const RINGTONE_ID = 'ringtone_statistic_new.RINGTONE_ID';

	
	const DOWNLOAD_DAY_NO = 'ringtone_statistic_new.DOWNLOAD_DAY_NO';

	
	const DOWNLOAD_WEEK_NO = 'ringtone_statistic_new.DOWNLOAD_WEEK_NO';

	
	const DOWNLOAD_MONTH_NO = 'ringtone_statistic_new.DOWNLOAD_MONTH_NO';

	
	const DOWNLOAD_YEAR_NO = 'ringtone_statistic_new.DOWNLOAD_YEAR_NO';

	
	const DOWNLOAD_TODAY = 'ringtone_statistic_new.DOWNLOAD_TODAY';

	
	const DOWNLOAD_THIS_WEEK = 'ringtone_statistic_new.DOWNLOAD_THIS_WEEK';

	
	const DOWNLOAD_THIS_MONTH = 'ringtone_statistic_new.DOWNLOAD_THIS_MONTH';

	
	const DOWNLOAD_TOTAL = 'ringtone_statistic_new.DOWNLOAD_TOTAL';

	
	const DOWNLOAD_YESTERDAY = 'ringtone_statistic_new.DOWNLOAD_YESTERDAY';

	
	const DOWNLOAD_LAST_WEEK = 'ringtone_statistic_new.DOWNLOAD_LAST_WEEK';

	
	const DOWNLOAD_LAST_MONTH = 'ringtone_statistic_new.DOWNLOAD_LAST_MONTH';

	
	const COMMENT_DAY_NO = 'ringtone_statistic_new.COMMENT_DAY_NO';

	
	const COMMENT_WEEK_NO = 'ringtone_statistic_new.COMMENT_WEEK_NO';

	
	const COMMENT_MONTH_NO = 'ringtone_statistic_new.COMMENT_MONTH_NO';

	
	const COMMENT_YEAR_NO = 'ringtone_statistic_new.COMMENT_YEAR_NO';

	
	const COMMENT_TODAY = 'ringtone_statistic_new.COMMENT_TODAY';

	
	const COMMENT_THIS_WEEK = 'ringtone_statistic_new.COMMENT_THIS_WEEK';

	
	const COMMENT_THIS_MONTH = 'ringtone_statistic_new.COMMENT_THIS_MONTH';

	
	const COMMENT_TOTAL = 'ringtone_statistic_new.COMMENT_TOTAL';

	
	const VOTE_DAY_NO = 'ringtone_statistic_new.VOTE_DAY_NO';

	
	const VOTE_WEEK_NO = 'ringtone_statistic_new.VOTE_WEEK_NO';

	
	const VOTE_MONTH_NO = 'ringtone_statistic_new.VOTE_MONTH_NO';

	
	const VOTE_YEAR_NO = 'ringtone_statistic_new.VOTE_YEAR_NO';

	
	const VOTE_TODAY = 'ringtone_statistic_new.VOTE_TODAY';

	
	const VOTE_THIS_WEEK = 'ringtone_statistic_new.VOTE_THIS_WEEK';

	
	const VOTE_THIS_MONTH = 'ringtone_statistic_new.VOTE_THIS_MONTH';

	
	const VOTE_TOTAL = 'ringtone_statistic_new.VOTE_TOTAL';

	
	const PLAY_DAY_NO = 'ringtone_statistic_new.PLAY_DAY_NO';

	
	const PLAY_WEEK_NO = 'ringtone_statistic_new.PLAY_WEEK_NO';

	
	const PLAY_MONTH_NO = 'ringtone_statistic_new.PLAY_MONTH_NO';

	
	const PLAY_YEAR_NO = 'ringtone_statistic_new.PLAY_YEAR_NO';

	
	const PLAY_TODAY = 'ringtone_statistic_new.PLAY_TODAY';

	
	const PLAY_THIS_WEEK = 'ringtone_statistic_new.PLAY_THIS_WEEK';

	
	const PLAY_THIS_MONTH = 'ringtone_statistic_new.PLAY_THIS_MONTH';

	
	const PLAY_TOTAL = 'ringtone_statistic_new.PLAY_TOTAL';

	
	const RECENT_DOWNLOAD_USERNAME = 'ringtone_statistic_new.RECENT_DOWNLOAD_USERNAME';

	
	const RECENT_DOWNLOAD_USER_ID = 'ringtone_statistic_new.RECENT_DOWNLOAD_USER_ID';

	
	const RECENT_DOWNLOAD_DATETIME = 'ringtone_statistic_new.RECENT_DOWNLOAD_DATETIME';

	
	const CATEGORY_ID = 'ringtone_statistic_new.CATEGORY_ID';

	
	const CATEGORY_NAME = 'ringtone_statistic_new.CATEGORY_NAME';

	
	const CREATOR_ID = 'ringtone_statistic_new.CREATOR_ID';

	
	const ARTIST_ID = 'ringtone_statistic_new.ARTIST_ID';

	
	private static $phpNameMap = null;


	
	private static $fieldNames = array (
		BasePeer::TYPE_PHPNAME => array ('Id', 'RingtoneId', 'DownloadDayNo', 'DownloadWeekNo', 'DownloadMonthNo', 'DownloadYearNo', 'DownloadToday', 'DownloadThisWeek', 'DownloadThisMonth', 'DownloadTotal', 'DownloadYesterday', 'DownloadLastWeek', 'DownloadLastMonth', 'CommentDayNo', 'CommentWeekNo', 'CommentMonthNo', 'CommentYearNo', 'CommentToday', 'CommentThisWeek', 'CommentThisMonth', 'CommentTotal', 'VoteDayNo', 'VoteWeekNo', 'VoteMonthNo', 'VoteYearNo', 'VoteToday', 'VoteThisWeek', 'VoteThisMonth', 'VoteTotal', 'PlayDayNo', 'PlayWeekNo', 'PlayMonthNo', 'PlayYearNo', 'PlayToday', 'PlayThisWeek', 'PlayThisMonth', 'PlayTotal', 'RecentDownloadUsername', 'RecentDownloadUserId', 'RecentDownloadDatetime', 'CategoryId', 'CategoryName', 'CreatorId', 'ArtistId', ),
		BasePeer::TYPE_COLNAME => array (RingtoneStatisticNewPeer::ID, RingtoneStatisticNewPeer::RINGTONE_ID, RingtoneStatisticNewPeer::DOWNLOAD_DAY_NO, RingtoneStatisticNewPeer::DOWNLOAD_WEEK_NO, RingtoneStatisticNewPeer::DOWNLOAD_MONTH_NO, RingtoneStatisticNewPeer::DOWNLOAD_YEAR_NO, RingtoneStatisticNewPeer::DOWNLOAD_TODAY, RingtoneStatisticNewPeer::DOWNLOAD_THIS_WEEK, RingtoneStatisticNewPeer::DOWNLOAD_THIS_MONTH, RingtoneStatisticNewPeer::DOWNLOAD_TOTAL, RingtoneStatisticNewPeer::DOWNLOAD_YESTERDAY, RingtoneStatisticNewPeer::DOWNLOAD_LAST_WEEK, RingtoneStatisticNewPeer::DOWNLOAD_LAST_MONTH, RingtoneStatisticNewPeer::COMMENT_DAY_NO, RingtoneStatisticNewPeer::COMMENT_WEEK_NO, RingtoneStatisticNewPeer::COMMENT_MONTH_NO, RingtoneStatisticNewPeer::COMMENT_YEAR_NO, RingtoneStatisticNewPeer::COMMENT_TODAY, RingtoneStatisticNewPeer::COMMENT_THIS_WEEK, RingtoneStatisticNewPeer::COMMENT_THIS_MONTH, RingtoneStatisticNewPeer::COMMENT_TOTAL, RingtoneStatisticNewPeer::VOTE_DAY_NO, RingtoneStatisticNewPeer::VOTE_WEEK_NO, RingtoneStatisticNewPeer::VOTE_MONTH_NO, RingtoneStatisticNewPeer::VOTE_YEAR_NO, RingtoneStatisticNewPeer::VOTE_TODAY, RingtoneStatisticNewPeer::VOTE_THIS_WEEK, RingtoneStatisticNewPeer::VOTE_THIS_MONTH, RingtoneStatisticNewPeer::VOTE_TOTAL, RingtoneStatisticNewPeer::PLAY_DAY_NO, RingtoneStatisticNewPeer::PLAY_WEEK_NO, RingtoneStatisticNewPeer::PLAY_MONTH_NO, RingtoneStatisticNewPeer::PLAY_YEAR_NO, RingtoneStatisticNewPeer::PLAY_TODAY, RingtoneStatisticNewPeer::PLAY_THIS_WEEK, RingtoneStatisticNewPeer::PLAY_THIS_MONTH, RingtoneStatisticNewPeer::PLAY_TOTAL, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USERNAME, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USER_ID, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_DATETIME, RingtoneStatisticNewPeer::CATEGORY_ID, RingtoneStatisticNewPeer::CATEGORY_NAME, RingtoneStatisticNewPeer::CREATOR_ID, RingtoneStatisticNewPeer::ARTIST_ID, ),
		BasePeer::TYPE_FIELDNAME => array ('id', 'ringtone_id', 'download_day_no', 'download_week_no', 'download_month_no', 'download_year_no', 'download_today', 'download_this_week', 'download_this_month', 'download_total', 'download_yesterday', 'download_last_week', 'download_last_month', 'comment_day_no', 'comment_week_no', 'comment_month_no', 'comment_year_no', 'comment_today', 'comment_this_week', 'comment_this_month', 'comment_total', 'vote_day_no', 'vote_week_no', 'vote_month_no', 'vote_year_no', 'vote_today', 'vote_this_week', 'vote_this_month', 'vote_total', 'play_day_no', 'play_week_no', 'play_month_no', 'play_year_no', 'play_today', 'play_this_week', 'play_this_month', 'play_total', 'recent_download_username', 'recent_download_user_id', 'recent_download_datetime', 'category_id', 'category_name', 'creator_id', 'artist_id', ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, )
	);

	
	private static $fieldKeys = array (
		BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'RingtoneId' => 1, 'DownloadDayNo' => 2, 'DownloadWeekNo' => 3, 'DownloadMonthNo' => 4, 'DownloadYearNo' => 5, 'DownloadToday' => 6, 'DownloadThisWeek' => 7, 'DownloadThisMonth' => 8, 'DownloadTotal' => 9, 'DownloadYesterday' => 10, 'DownloadLastWeek' => 11, 'DownloadLastMonth' => 12, 'CommentDayNo' => 13, 'CommentWeekNo' => 14, 'CommentMonthNo' => 15, 'CommentYearNo' => 16, 'CommentToday' => 17, 'CommentThisWeek' => 18, 'CommentThisMonth' => 19, 'CommentTotal' => 20, 'VoteDayNo' => 21, 'VoteWeekNo' => 22, 'VoteMonthNo' => 23, 'VoteYearNo' => 24, 'VoteToday' => 25, 'VoteThisWeek' => 26, 'VoteThisMonth' => 27, 'VoteTotal' => 28, 'PlayDayNo' => 29, 'PlayWeekNo' => 30, 'PlayMonthNo' => 31, 'PlayYearNo' => 32, 'PlayToday' => 33, 'PlayThisWeek' => 34, 'PlayThisMonth' => 35, 'PlayTotal' => 36, 'RecentDownloadUsername' => 37, 'RecentDownloadUserId' => 38, 'RecentDownloadDatetime' => 39, 'CategoryId' => 40, 'CategoryName' => 41, 'CreatorId' => 42, 'ArtistId' => 43, ),
		BasePeer::TYPE_COLNAME => array (RingtoneStatisticNewPeer::ID => 0, RingtoneStatisticNewPeer::RINGTONE_ID => 1, RingtoneStatisticNewPeer::DOWNLOAD_DAY_NO => 2, RingtoneStatisticNewPeer::DOWNLOAD_WEEK_NO => 3, RingtoneStatisticNewPeer::DOWNLOAD_MONTH_NO => 4, RingtoneStatisticNewPeer::DOWNLOAD_YEAR_NO => 5, RingtoneStatisticNewPeer::DOWNLOAD_TODAY => 6, RingtoneStatisticNewPeer::DOWNLOAD_THIS_WEEK => 7, RingtoneStatisticNewPeer::DOWNLOAD_THIS_MONTH => 8, RingtoneStatisticNewPeer::DOWNLOAD_TOTAL => 9, RingtoneStatisticNewPeer::DOWNLOAD_YESTERDAY => 10, RingtoneStatisticNewPeer::DOWNLOAD_LAST_WEEK => 11, RingtoneStatisticNewPeer::DOWNLOAD_LAST_MONTH => 12, RingtoneStatisticNewPeer::COMMENT_DAY_NO => 13, RingtoneStatisticNewPeer::COMMENT_WEEK_NO => 14, RingtoneStatisticNewPeer::COMMENT_MONTH_NO => 15, RingtoneStatisticNewPeer::COMMENT_YEAR_NO => 16, RingtoneStatisticNewPeer::COMMENT_TODAY => 17, RingtoneStatisticNewPeer::COMMENT_THIS_WEEK => 18, RingtoneStatisticNewPeer::COMMENT_THIS_MONTH => 19, RingtoneStatisticNewPeer::COMMENT_TOTAL => 20, RingtoneStatisticNewPeer::VOTE_DAY_NO => 21, RingtoneStatisticNewPeer::VOTE_WEEK_NO => 22, RingtoneStatisticNewPeer::VOTE_MONTH_NO => 23, RingtoneStatisticNewPeer::VOTE_YEAR_NO => 24, RingtoneStatisticNewPeer::VOTE_TODAY => 25, RingtoneStatisticNewPeer::VOTE_THIS_WEEK => 26, RingtoneStatisticNewPeer::VOTE_THIS_MONTH => 27, RingtoneStatisticNewPeer::VOTE_TOTAL => 28, RingtoneStatisticNewPeer::PLAY_DAY_NO => 29, RingtoneStatisticNewPeer::PLAY_WEEK_NO => 30, RingtoneStatisticNewPeer::PLAY_MONTH_NO => 31, RingtoneStatisticNewPeer::PLAY_YEAR_NO => 32, RingtoneStatisticNewPeer::PLAY_TODAY => 33, RingtoneStatisticNewPeer::PLAY_THIS_WEEK => 34, RingtoneStatisticNewPeer::PLAY_THIS_MONTH => 35, RingtoneStatisticNewPeer::PLAY_TOTAL => 36, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USERNAME => 37, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USER_ID => 38, RingtoneStatisticNewPeer::RECENT_DOWNLOAD_DATETIME => 39, RingtoneStatisticNewPeer::CATEGORY_ID => 40, RingtoneStatisticNewPeer::CATEGORY_NAME => 41, RingtoneStatisticNewPeer::CREATOR_ID => 42, RingtoneStatisticNewPeer::ARTIST_ID => 43, ),
		BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'ringtone_id' => 1, 'download_day_no' => 2, 'download_week_no' => 3, 'download_month_no' => 4, 'download_year_no' => 5, 'download_today' => 6, 'download_this_week' => 7, 'download_this_month' => 8, 'download_total' => 9, 'download_yesterday' => 10, 'download_last_week' => 11, 'download_last_month' => 12, 'comment_day_no' => 13, 'comment_week_no' => 14, 'comment_month_no' => 15, 'comment_year_no' => 16, 'comment_today' => 17, 'comment_this_week' => 18, 'comment_this_month' => 19, 'comment_total' => 20, 'vote_day_no' => 21, 'vote_week_no' => 22, 'vote_month_no' => 23, 'vote_year_no' => 24, 'vote_today' => 25, 'vote_this_week' => 26, 'vote_this_month' => 27, 'vote_total' => 28, 'play_day_no' => 29, 'play_week_no' => 30, 'play_month_no' => 31, 'play_year_no' => 32, 'play_today' => 33, 'play_this_week' => 34, 'play_this_month' => 35, 'play_total' => 36, 'recent_download_username' => 37, 'recent_download_user_id' => 38, 'recent_download_datetime' => 39, 'category_id' => 40, 'category_name' => 41, 'creator_id' => 42, 'artist_id' => 43, ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, )
	);

	
	public static function getMapBuilder()
	{
		include_once 'lib/model/map/RingtoneStatisticNewMapBuilder.php';
		return BasePeer::getMapBuilder('lib.model.map.RingtoneStatisticNewMapBuilder');
	}
	
	public static function getPhpNameMap()
	{
		if (self::$phpNameMap === null) {
			$map = RingtoneStatisticNewPeer::getTableMap();
			$columns = $map->getColumns();
			$nameMap = array();
			foreach ($columns as $column) {
				$nameMap[$column->getPhpName()] = $column->getColumnName();
			}
			self::$phpNameMap = $nameMap;
		}
		return self::$phpNameMap;
	}
	
	static public function translateFieldName($name, $fromType, $toType)
	{
		$toNames = self::getFieldNames($toType);
		$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
		if ($key === null) {
			throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
		}
		return $toNames[$key];
	}

	

	static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
	{
		if (!array_key_exists($type, self::$fieldNames)) {
			throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
		}
		return self::$fieldNames[$type];
	}

	
	public static function alias($alias, $column)
	{
		return str_replace(RingtoneStatisticNewPeer::TABLE_NAME.'.', $alias.'.', $column);
	}

	
	public static function addSelectColumns(Criteria $criteria)
	{

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::ID);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::RINGTONE_ID);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_DAY_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_WEEK_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_MONTH_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_YEAR_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_TODAY);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_THIS_WEEK);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_THIS_MONTH);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_TOTAL);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_YESTERDAY);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_LAST_WEEK);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::DOWNLOAD_LAST_MONTH);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_DAY_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_WEEK_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_MONTH_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_YEAR_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_TODAY);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_THIS_WEEK);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_THIS_MONTH);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::COMMENT_TOTAL);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_DAY_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_WEEK_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_MONTH_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_YEAR_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_TODAY);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_THIS_WEEK);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_THIS_MONTH);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::VOTE_TOTAL);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_DAY_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_WEEK_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_MONTH_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_YEAR_NO);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_TODAY);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_THIS_WEEK);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_THIS_MONTH);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::PLAY_TOTAL);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USERNAME);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::RECENT_DOWNLOAD_USER_ID);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::RECENT_DOWNLOAD_DATETIME);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::CATEGORY_ID);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::CATEGORY_NAME);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::CREATOR_ID);

		$criteria->addSelectColumn(RingtoneStatisticNewPeer::ARTIST_ID);

	}

	const COUNT = 'COUNT(ringtone_statistic_new.ID)';
	const COUNT_DISTINCT = 'COUNT(DISTINCT ringtone_statistic_new.ID)';

	
	public static function doCount(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(RingtoneStatisticNewPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(RingtoneStatisticNewPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = RingtoneStatisticNewPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}
	
	public static function doSelectOne(Criteria $criteria, $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = RingtoneStatisticNewPeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}
	
	public static function doSelect(Criteria $criteria, $con = null)
	{
		return RingtoneStatisticNewPeer::populateObjects(RingtoneStatisticNewPeer::doSelectRS($criteria, $con));
	}
	
	public static function doSelectRS(Criteria $criteria, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if (!$criteria->getSelectColumns()) {
			$criteria = clone $criteria;
			RingtoneStatisticNewPeer::addSelectColumns($criteria);
		}

				$criteria->setDbName(self::DATABASE_NAME);

						return BasePeer::doSelect($criteria, $con);
	}
	
	public static function populateObjects(ResultSet $rs)
	{
		$results = array();
	
				$cls = RingtoneStatisticNewPeer::getOMClass();
		$cls = Propel::import($cls);
				while($rs->next()) {
		
			$obj = new $cls();
			$obj->hydrate($rs);
			$results[] = $obj;
			
		}
		return $results;
	}
	
	public static function getTableMap()
	{
		return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
	}

	
	public static function getOMClass()
	{
		return RingtoneStatisticNewPeer::CLASS_DEFAULT;
	}

	
	public static function doInsert($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} else {
			$criteria = $values->buildCriteria(); 		}

		$criteria->remove(RingtoneStatisticNewPeer::ID); 

				$criteria->setDbName(self::DATABASE_NAME);

		try {
									$con->begin();
			$pk = BasePeer::doInsert($criteria, $con);
			$con->commit();
		} catch(PropelException $e) {
			$con->rollback();
			throw $e;
		}

		return $pk;
	}

	
	public static function doUpdate($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$selectCriteria = new Criteria(self::DATABASE_NAME);

		if ($values instanceof Criteria) {
			$criteria = clone $values; 
			$comparison = $criteria->getComparison(RingtoneStatisticNewPeer::ID);
			$selectCriteria->add(RingtoneStatisticNewPeer::ID, $criteria->remove(RingtoneStatisticNewPeer::ID), $comparison);

		} else { 			$criteria = $values->buildCriteria(); 			$selectCriteria = $values->buildPkeyCriteria(); 		}

				$criteria->setDbName(self::DATABASE_NAME);

		return BasePeer::doUpdate($selectCriteria, $criteria, $con);
	}

	
	public static function doDeleteAll($con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}
		$affectedRows = 0; 		try {
									$con->begin();
			$affectedRows += BasePeer::doDeleteAll(RingtoneStatisticNewPeer::TABLE_NAME, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	 public static function doDelete($values, $con = null)
	 {
		if ($con === null) {
			$con = Propel::getConnection(RingtoneStatisticNewPeer::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} elseif ($values instanceof RingtoneStatisticNew) {

			$criteria = $values->buildPkeyCriteria();
		} else {
						$criteria = new Criteria(self::DATABASE_NAME);
			$criteria->add(RingtoneStatisticNewPeer::ID, (array) $values, Criteria::IN);
		}

				$criteria->setDbName(self::DATABASE_NAME);

		$affectedRows = 0; 
		try {
									$con->begin();
			
			$affectedRows += BasePeer::doDelete($criteria, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public static function doValidate(RingtoneStatisticNew $obj, $cols = null)
	{
		$columns = array();

		if ($cols) {
			$dbMap = Propel::getDatabaseMap(RingtoneStatisticNewPeer::DATABASE_NAME);
			$tableMap = $dbMap->getTable(RingtoneStatisticNewPeer::TABLE_NAME);

			if (! is_array($cols)) {
				$cols = array($cols);
			}

			foreach($cols as $colName) {
				if ($tableMap->containsColumn($colName)) {
					$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
					$columns[$colName] = $obj->$get();
				}
			}
		} else {

		}

		$res =  BasePeer::doValidate(RingtoneStatisticNewPeer::DATABASE_NAME, RingtoneStatisticNewPeer::TABLE_NAME, $columns);
    if ($res !== true) {
        $request = sfContext::getInstance()->getRequest();
        foreach ($res as $failed) {
            $col = RingtoneStatisticNewPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
            $request->setError($col, $failed->getMessage());
        }
    }

    return $res;
	}

	
	public static function retrieveByPK($pk, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$criteria = new Criteria(RingtoneStatisticNewPeer::DATABASE_NAME);

		$criteria->add(RingtoneStatisticNewPeer::ID, $pk);


		$v = RingtoneStatisticNewPeer::doSelect($criteria, $con);

		return !empty($v) > 0 ? $v[0] : null;
	}

	
	public static function retrieveByPKs($pks, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$objs = null;
		if (empty($pks)) {
			$objs = array();
		} else {
			$criteria = new Criteria();
			$criteria->add(RingtoneStatisticNewPeer::ID, $pks, Criteria::IN);
			$objs = RingtoneStatisticNewPeer::doSelect($criteria, $con);
		}
		return $objs;
	}

} 
if (Propel::isInit()) {
			try {
		BaseRingtoneStatisticNewPeer::getMapBuilder();
	} catch (Exception $e) {
		Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
	}
} else {
			require_once 'lib/model/map/RingtoneStatisticNewMapBuilder.php';
	Propel::registerMapBuilder('lib.model.map.RingtoneStatisticNewMapBuilder');
}
